Custom Event Transformers are a powerful way to host custom code inside your incident resolution process, here’s an example of one that will redact American social security numbers “123-45-6789” and anything of the form “password: abc123”.
Pro-tip: an Account Owner can also hide the incident’s details by using the [Redact Incident button] (Account Owner can hide the incident’s details by using the Redact Incident button.) from the UI.
Create an integration of type “Custom Event Transformer” and paste in the following code. Once you have an integration key you can test it with this code on JSFiddle: https://jsfiddle.net/qy0Lvvd3/
function sanitize(str) {
console.log("sanitize")
console.log(str)
str = str.replace(/[0-9]{3}-[0-9]{2}-[0-9]{4}/gi, 'XXX-XX-XXXX');
str = str.replace(/password:.*/gi, 'password: redacted');
return str;
}
var details = PD.inputRequest.body.details
for (var p in details) {
details[p] = sanitize(details[p]);
}
var normalized_event = {
event_type: PD.Trigger,
description: PD.inputRequest.body.description,
details: details
};
PD.emitGenericEvents([normalized_event]);
And here’s what the results look like: